package com.mg.game.content.gamescreen;

import android.graphics.Bitmap;

import com.mg.framework.kernel.Actor;
import com.mg.framework.kernel.Screen;
import com.mg.framework.tiled.MapObject;
import com.mg.game.content.CollisionDetection;

public abstract class GameActor extends Actor {

	private MapObject mapObject;
	protected static CollisionDetection collisionDetection;

	protected int degree;
	protected float speed;
	private float speedX;
	private float speedY;
	public float tmpSpeedX;
	public float tmpSpeedY;

	public static void setCollisionDetection(
			CollisionDetection collisionDetection) {
		GameActor.collisionDetection = collisionDetection;
	}

	public GameActor(Screen screen, Bitmap bitmap, MapObject mapObject) {
		super(screen, bitmap);
		this.mapObject = mapObject;
		this.setX(this.mapObject.getX());
		this.setY(this.mapObject.getY());
	}

	protected void setSpeedXY(float speedX, float speedY) {
		this.speedX = speedX;
		this.speedY = speedY;
		this.tmpSpeedX = speedX;
		this.tmpSpeedY = speedY;
	}

	protected void launch() {
		this.tmpSpeedX = this.speedX;
		this.tmpSpeedY = this.speedY;
	}
	
	public float getSpeedXAbs() {
		return Math.abs(this.tmpSpeedX);
	}

	public float getSpeedYAbs() {
		return Math.abs(this.tmpSpeedY);
	}
}
